package cn.tannn.tcache.command;

import cn.tannn.tcache.core.Command;
import cn.tannn.tcache.core.Reply;
import cn.tannn.tcache.core.Tcache;

/**
 * keys 命令
 * <p> keys
 *
 * @author <a href="https://t.tannn.cn/">tnnn</a>
 * @version V1.0
 * @date 2024/6/19 下午8:15
 */
public class KeysCommand implements Command {
    @Override
    public String name() {
        return "KEYS";
    }

    @Override
    public Reply<?> exec(Tcache cache, String[] args) {
        String pattern = getKey(args);
        return Reply.array(cache.keys(pattern));
    }
}
